package LuoGu.递归_递推.Function;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.StreamTokenizer;

public class Main {
    static long [][][] temp = new long [25][25][25];
    public static void main(String[] args) throws IOException {
        StreamTokenizer st = new StreamTokenizer(new BufferedReader(new InputStreamReader(System.in)));
        while(true){
            st.nextToken();
            long a = (long) st.nval;
            st.nextToken();
            long b = (long) st.nval;
            st.nextToken();
            long c = (long) st.nval;
            if(a==-1&&b==-1&&c==-1) break;
            else{
                long ans = 0;
                int a1 = 0,b1 = 0,c1 = 0;
                if(a>20) a1 = 21;
                if(b>20) b1 = 21;
                if(c>20) c1 = 21;
                ans = dg(a1,b1,c1);
                System.out.println(String.format("w(%d, %d, %d) = %d",a,b,c,ans));
            }
        }
    }

    public static long dg(int a,int b,int c){
        if(a<=0||b<=0||c<=0) return 1;
        else if(a>20||b>20||c>20){
            temp[20][20][20] = dg(20,20,20);
        }
        else if(temp[a][b][c]!=0) return temp[a][b][c];
        else if(a<b&&b<c){
            temp[a][b][c] = dg(a,b,c-1)+dg(a,b-1,c-1)-dg(a,b-1,c);
        }else temp[a][b][c] = dg(a-1,b,c)+dg(a-1,b-1,c)+dg(a-1,b,c-1)-dg(a-1,b-1,c-1);
        return temp[a][b][c];
    }
}
